//package com.example.tool.conf;
//
//import cn.hutool.core.util.ObjectUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.example.tool.bean.business.WarehouseConfigEntity;
//import com.example.tool.bean.business.WarehouseExpressDeliveryConfig;
//import com.example.tool.bean.business.WarehouseInterceptionConfig;
//import com.example.tool.bean.business.wdt.SelfOrderDO;
//import com.example.tool.bean.business.wechat.SpreadSheetGetSheetPropertiesItem;
//import com.example.tool.bean.business.wechat.SpreadSheetGetSheetPropertiesResponse;
//import com.example.tool.erp.sdk.api.sales.dto.TradeQueryResponse;
//import com.example.tool.service.RedisService;
//import com.example.tool.service.selforder.SelfOrderService;
//import com.example.tool.util.DDUtil;
//import com.example.tool.util.ExpressDeliveryUtil.ExpressDeliveryResult;
//import com.example.tool.util.ExpressDeliveryUtil.ExpressDeliveryUtil;
//import com.example.tool.util.WDTUtil;
//import com.example.tool.util.WeChatUtil;
//import com.google.common.collect.Lists;
//import org.apache.commons.collections4.ListUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import java.text.ParseException;
//import java.text.SimpleDateFormat;
//import java.time.LocalDateTime;
//import java.time.format.DateTimeFormatter;
//import java.util.AbstractMap;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Collections;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Objects;
//import java.util.concurrent.TimeUnit;
//import java.util.stream.Collectors;
//
//import static com.example.tool.util.ExpressDeliveryUtil.ExpressDeliveryUtil.JT;
//import static com.example.tool.util.ExpressDeliveryUtil.ExpressDeliveryUtil.STO;
//import static com.example.tool.util.ExpressDeliveryUtil.ExpressDeliveryUtil.UNKNOWN;
//import static com.example.tool.util.ExpressDeliveryUtil.ExpressDeliveryUtil.YTO;
//import static com.example.tool.util.ExpressDeliveryUtil.ExpressDeliveryUtil.YUN_DA;
//import static com.example.tool.util.ExpressDeliveryUtil.ExpressDeliveryUtil.ZTO;
//import static com.example.tool.util.ExpressDeliveryUtil.ExpressDeliveryUtil.judgeExpressDeliveryType;
//import static com.example.tool.util.WeChatUtil.batchUpdateSpreadsheet;
//import static com.example.tool.util.WeChatUtil.createAddSheetRequest;
//import static com.example.tool.util.WeChatUtil.createUpdateSheetRequest;
//import static com.example.tool.util.WeChatUtil.getDocumentShareUrl;
//import static com.example.tool.util.WeChatUtil.spreadSheetGetSheetProperties;
//
///**
// * 提醒审单群和仓库群
// */
//@Component
//public class SelfOrderCollectTasks {
//    @Autowired
//    private RedisService redisService;
//    @Qualifier("selfOrderService")
//    @Autowired
//    private  SelfOrderService selfOrderService;
//    private static final String ddLinkUrl="https://alidocs.dingtalk.com/i/nodes/%s";
//    private static final String qwLinkUrl="https://doc.weixin.qq.com/smartsheet/%s";
//    private static final String rangeDropShipAddressTemplate="A%s:D%s";
//    private static final String rangeShippedAddressTemplate="A%s:F%s";
//    private static final String keyTemplate="sys:sendOrderWorkbookId:%s:%s";
//    //已审核未发货
//    private  List<Integer>findDropshippingStatus=Arrays.asList(16,19,20,21,23,24,25,27,30,35,40);
//    //已发货
//    private  List<Integer>findShippedStatus=Arrays.asList(95,96,101,110);
//    //代发货和已发货
//    private  List<Integer>allFindShippedStatus=Arrays.asList(16,19,20,21,23,24,25,27,30,35,40,55,95,96,101,110);
//    private static final  Integer readBatchSize=3000;
//    private static final  Integer updateBatchSize=3000;
//    private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//    private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//    private static final SimpleDateFormat sdfYYYYMMdd = new SimpleDateFormat("yyyy-MM-dd");
//    private static final SimpleDateFormat sdfYYYYMM= new SimpleDateFormat("yyyy-MM");
//    //保存时间值
//    private static final Integer dataSaveDays=7;
//    //保存时间的单位
//    private static final TimeUnit timeUnit = TimeUnit.DAYS;
//    //常温
//    private static final  String roomTemperatureType="1";
//    //冻品
//    private static final  String frozenProductsType="2";
//    private static HashMap<String, WarehouseConfigEntity> WAREHOUSE_INTERCEPT_CONFIG=new HashMap<>();
//    //SEC06f5c28b40b271fe2e83c05efa75ab0cf6d8ec1780f98e4411dbf8ac2f9dc49a
//    //https://oapi.dingtalk.com/robot/send?access_token=df183f772916eecd423fdf6f1594d6c60d5c86f6b68c52af2611b55cd89bc91d
//    static {
//            WAREHOUSE_INTERCEPT_CONFIG.put("CNHC",//苍南-龙港（常温仓）
//            new WarehouseConfigEntity(roomTemperatureType,//常温
//            new WarehouseInterceptionConfig(//龙港仓（常温）审单对接群
//            "YndMj49yWjmvkeaxi0zrwMeB83pmz5aA",
//            "SEC19af71dcdb6f679f375de58a69a74dd66d723df30ea6bd6e5fd3d2aba86e8208",
//            "80e2322d737f724c603f6157168246ab6883e0713cc705646bb52d336b6df3e3",null,null)
//            , Arrays.asList(
//            new WarehouseExpressDeliveryConfig(//龙港仓（常温）快递售后群（申通）
//            STO,
//            1,
//            "vy20BglGWOMOykAqTlm5lmv2JA7depqY",
//            "SEC3530451e3910a9de749c955ab402b2a23d029da3aff72b0e91944f4ffea29901",
//            "3be4f4c7c52fed6d3438909cc938ac19d2a79ecc40a09563318b87cd03752b73",null,null)
//            ,new WarehouseExpressDeliveryConfig(//龙港中通
//            ZTO,
//            2,
//            "dcalkAfPGxsUlw493mzSZm3OFbUIsxtjEHMnsT-3JOUyz-k40yg_pS8UOybaxTfPD2L7aJO9VMv9AWUhdTMpcQ0A",
//            "testchat123",
//          "",null,null)
//            , new WarehouseExpressDeliveryConfig(//龙港极兔
//            JT,
//            2,
//            "dcUvPugRZuRLHTPq5g_SkPM4A_sCASbcq_HwkNrYdokrOlisMWGnv4cJpj7s9fJODMedqoq7yRzhOx0olIlMt0xQ",
//            "JGZTGroupChat",
//           "",null,null)
//            ))
//            );
//
//
//            WAREHOUSE_INTERCEPT_CONFIG.put("cqztc-01",//重庆-中通（冻品仓）
//            new WarehouseConfigEntity(frozenProductsType,//冻品
//            new WarehouseInterceptionConfig(//重庆仓（冻品）审单对接群
//            "dQPGYqjpJYm0ALeNidYpKgMvJakx1Z5N",
//                    "SEC5c0852177e757940afaaecad5fd0ddd55f653c299bad9a6d5204e81752788afe",
//                    "b665f561ffd7755dfb003b82d2446b6e5ddafecc3b213e4db8a04da9799b3067",null,null),
//            Collections.singletonList(new WarehouseExpressDeliveryConfig(//重庆仓（冻品）快递售后群
//            UNKNOWN,
//            1,
//            "YndMj49yWjmvkeaxi0zQylXE83pmz5aA",
//                    "SEC96bf424e75957b1940ade52514036b1facbd09eafd5ca7edbf1fbbcc471a89c6",
//                    "933590ef48062a42b7906a8fd876b7782df3910c47a23534f31ac16ec88dc735",null,null)))
//
//            );
//
//            WAREHOUSE_INTERCEPT_CONFIG.put("233565416",//广州-江高（常温仓）
//            new WarehouseConfigEntity(roomTemperatureType,//常温
//            new WarehouseInterceptionConfig(//江高仓（常温）审单对接群
//            "mExel2BLV5yX62NDIEbYqZGyVgk9rpMq",
//                    "SEC71886d7de0e913186f1c34b796a5f8381b29537f327d3da2977b24d590c69a54",
//                    "939653f7533235b20bb6f47b49517587c43c838f78de8f776e041f07eefdd8b3",null,null),
//            Arrays.asList(new WarehouseExpressDeliveryConfig(//江高仓（常温）快递售后群（圆通）
//            YTO,
//            1,
//            "Qnp9zOoBVBezpxbnFGryA31pW1DK0g6l",
//                            "SECda76372127b3a91fc2d76aed4872c7caa3c31028352c7e9876c48797ba5d1ad1",
//                            "f45c82911719da8d29fc5164b4c2588e51e0d68b278d116b4fbd8cb2dc63fa50",null,null)
//            ,new WarehouseExpressDeliveryConfig(//江高中通快递对接
//            ZTO,
//            2,
//            "dcnT0j7TfzTCnOVDaMq6r2g1dqebWrURHwqPKQ4xf4OsCIV5vseKcOUrbNFchQWqg3MCRwKWAwJtVT3gKxJw0vcg",
//            "JGZTGroupChat",
//            "",null,null)
//            ,new WarehouseExpressDeliveryConfig(//忆北江高极兔
//            JT,
//            2,
//            "dcBJGvaz6fDA0KkJh6-vCcy9IqvJt8c_dPrAvroND81fSM65H6ng-vuToUX0x4UI0SQ1cqYKG4YuYUJtcM5Xgy_Q",
//            "JTJGGroupChat",
//            "",null,null)
//            ,new WarehouseExpressDeliveryConfig(//江高 广东 韵达
//            YUN_DA,
//            2,
//            "dc8xSV0rKdQLEZGdqzr69JkfDwLi60AIP-zxIoo5KYmPyRUYts6sCtVMVZOM_D76Z67fWFGTlVRxaej2PEGjhdcA",
//            "GZYDGroupChat",
//             "",null,null)
//            )));
//            WAREHOUSE_INTERCEPT_CONFIG.put("WH0000076",//合肥-肥西（冻品仓）
//            new WarehouseConfigEntity(frozenProductsType,//冻品
//            new WarehouseInterceptionConfig(//合肥仓（冻品）审单对接群
//            "o14dA3GK8gzNMZ2YF95glX9PJ9ekBD76",
//                    "SECa00b70bcf2d9e339d899e4449b8e95ffbfe042759b7c83294f1e70a5476d4c1b",
//                    "46653a24eda213db1d93fa75b78a865b702f8c7d662345089d7dee66a58ddde5",null,null),
//            Arrays.asList( new WarehouseExpressDeliveryConfig(//台肥仓（冻品）快递售后群（统一）
//            ExpressDeliveryUtil.UNKNOWN,
//            1,
//            "P7QG4Yx2Jp3NaeblUY4AAxQwV9dEq3XD",
//                    "SEC5e61e55f743d8952cba699be732e43eaf7bdd12da0b559c9591454f7b76bcd67",
//                    "dd6f2fe2186a84b85852025680db4ad2573240bb9481c12f9cf3f8802a0af44e",null,null))
//            ));
//            WAREHOUSE_INTERCEPT_CONFIG.put("HFGXC02",//济南-天泽（冻品仓）
//            new WarehouseConfigEntity(frozenProductsType,//冻品
//            new WarehouseInterceptionConfig(//天泽仓（冻品）审单对接群
//            "MNDoBb60VL9ObMEPFrz7DPEzJlemrZQ3",
//                    "SEC02bc013b8a145ac6f7eec43b7e75eeafb9267af06105c2d33572a49a6a9594f7",
//                    "e827de0a3c7c23763b7aa34e5a2750bd9d48e8a01fdd10e658eb674b11ef3bfb",null,null),
//            Arrays.asList( new WarehouseExpressDeliveryConfig(//天泽仓（冻品）快递售后群（统一）
//            ExpressDeliveryUtil.UNKNOWN,
//            1,
//            "YndMj49yWjmvkeaxi0zQzXqw83pmz5aA",
//                    "SEC213971c59ea21362ab08113d632268a413aabbeb3c40de9f79b64be019d5c4a0",
//                    "49014cfc32833bf3e1bf99ada174ec3ce018f1aee533ef1e7b2a21f82e803e0b",null,null) )
//            ));
//            WAREHOUSE_INTERCEPT_CONFIG.put("SHC",//上海-上海（冻品仓）
//            new WarehouseConfigEntity(frozenProductsType,//冻品
//            new WarehouseInterceptionConfig(//上海仓 （冻品）审单对接群
//            "2Amq4vjg89eqvP2NFdraMdL183kdP0wQ",
//                    "SEC0c1e7682f88bb4cb7166ecd3fe715ae005a626ef41595d04af62d069910e9d23",
//                    "f608f1d572bb78926f993125aaa8d84b6d49f1c5df50bcd01d1a3c2912d5f49b",null,null),
//            Arrays.asList( new WarehouseExpressDeliveryConfig(//上海仓（冻品）快递售后群
//            ExpressDeliveryUtil.UNKNOWN,
//            1,
//            "lyQod3RxJKvm0gEOCPKLLqMOVkb4Mw9r",
//                    "SECc3abcdd288e118ab8fb5058446575207c4ac39b7d790aca3fdd91d0af533ee14",
//                    "907e7b99a154cd1b93e6b5eee12bd1752c273ab36b76087d64964494245210a4",null,null))
//            ));
//            WAREHOUSE_INTERCEPT_CONFIG.put("gzdxc001",//广州-德信（冻品仓）
//            new WarehouseConfigEntity(frozenProductsType,//冻品
//            new WarehouseInterceptionConfig(//德信仓 （冻品）审单对接群
//            "qnYMoO1rWxbl3KAjUKk2AalwJ47Z3je9",
//                    "SEC65d0625b209020cc90739c903a5996c0769fa8e2688819ae4cfcd71e382f6317",
//                    "4c3acb26d958853d57f73325e5bd449904b9addc3c12efbee8914fe7242cdab5",null,null),
//            Arrays.asList( new WarehouseExpressDeliveryConfig(//德信仓（冻品）快递售后群
//            ExpressDeliveryUtil.UNKNOWN,
//            1,
//            "QG53mjyd80yjGN9lIdjOgNgwW6zbX04v",
//                    "SEC02533e52d5bf330638e1158784ef3fa150cfde8ac2e385e3d8adff522f0d820e",
//                    "99e098e1c67bfb7693156757a7a56f1d856f37df91b58dc0ff496347a19d6ef1",null,null))
//            ));
//            WAREHOUSE_INTERCEPT_CONFIG.put("jxsrcxc01",//江西-南昌（常温仓）
//            new WarehouseConfigEntity(roomTemperatureType,//常温
//            new WarehouseInterceptionConfig(//江西仓（常温）审单对接群
//            "m9bN7RYPWdXg9GkRIoQvMennWZd1wyK0",
//                    "SEC6bfb84740d75d8efeaf69aeeb97747465d7c111dc7c34f90ebc7fa89d9770bb9",
//                    "e6eaeec4d7e8d06c6f80849f459e2d032b938b617c22fb44246485bc6c9005bd",null,null)
//            , Arrays.asList(new WarehouseExpressDeliveryConfig(//江西仓（常温）快递售后群（圆通)
//            YTO,
//            1,
//            "oP0MALyR8kb9XAmOUE6qM5beJ3bzYmDO",
//                            "SEC56b4084a06e60b05406b4a49ddb660e46061c21ab2282694305436c567351cb9",
//                            "87bf9ed52b5c60b6a340aa5cfc7c260875cf1b15a542429fe660062d2cf72bcb",null,null),
//            new WarehouseExpressDeliveryConfig(//江西仓（常温）快递售后群（中通）
//            ZTO,
//            1,
//            "ZgpG2NdyVXaOEALjT3QOn265JMwvDqPk",
//                    "SECb2eb67a58fea92969487daa296a9536063fb35faa743df99c09d344bc1a86873",
//                    "c18019d56f6c24f4a9ff6ded03e67823c63d1e8adff761ed6e01152461e7bfd9",null,null))
//            ));
//            WAREHOUSE_INTERCEPT_CONFIG.put("csztdpc01",//长沙-中通（冻品仓）
//            new WarehouseConfigEntity(frozenProductsType,//冻品
//            new WarehouseInterceptionConfig(//长沙仓（冻品）审单对接群
//            "oP0MALyR8kb9XAmOUE6qvPmwJ3bzYmDO",
//                    "SEC29cb16689d420846a5b9bc319c2b33c5e0046097e9ec45ed9c255552300cee2f",
//                    "8ed9de0a29deae71b5adf2cc1b2542a2ebdd1d863b0ee96c42ca948a76a5cd55",null,null),
//            Collections.singletonList(new WarehouseExpressDeliveryConfig(//长沙仓（冻品）快递售后群（统一）
//            UNKNOWN,
//            1,
//            "o14dA3GK8gzNMZ2YF95zb331J9ekBD76",
//                    "SEC098707457239ad8f5644fed315bb2de2f8c2f711820a2fd08f48651295f8bfdd",
//                    "ecdb4ce675945a909f87f8e266065ebf1f8d3e6d1ff0557a563657f46c44852d",null,null))
//            ));
//            WAREHOUSE_INTERCEPT_CONFIG.put("hunan001",//湖南-长沙（常温仓）
//            new WarehouseConfigEntity(roomTemperatureType,//常温
//            new WarehouseInterceptionConfig(//长沙仓（常温）审单对接群
//            "kDnRL6jAJMDAYjEwHDZLr67dVyMoPYe1",
//                    "SECfde84f7f2dd69c99b6908fafb2aa5144c5db93c8177c203f956589d159eba57c",
//                    "44fa9a1f188fd78a96f8a5cb9553291344a31f1c4a1e9a68169bdd85fea9d1b4",null,null),
//            Collections.singletonList(new WarehouseExpressDeliveryConfig(//长沙仓（常温）快递售后群（统一）
//            UNKNOWN,
//            1,
//            "oP0MALyR8kb9XAmOUE6ogymZJ3bzYmDO",
//                    "SEC1e32020d251b1ce7fa59cef98f8ac79386f990ebc4196d60d34bd5e7f3d90008",
//                    "d82616b734a61bcfc6aae27b6bd5bcb70330b47f24210375b6185cd01818736d",null,null))
//            ));
//            WAREHOUSE_INTERCEPT_CONFIG.put("yiwu01",//浙江-义乌（常温仓）
//            new WarehouseConfigEntity(roomTemperatureType,//常温
//            new WarehouseInterceptionConfig(//义乌仓 （常温）审单对接群
//                    "Gl6Pm2Db8DemzxdRFqgvkNRyWxLq0Ee4",
//                    "SECe47c325f8d7a780f4dd40ad9dfc84eb24d962f4d4b55e323b0fb4ee23d514d91",
//                    "45cb669c31d7911fbfb678f95c9bc377e92370b9129922bcfdbd1045a2bbb460",null,null),
//            Collections.singletonList(new WarehouseExpressDeliveryConfig(//义乌仓 （常温）快递售后群（统一）
//            UNKNOWN,
//            1,
//                    "lyQod3RxJKvm0gEOCP2bregrVkb4Mw9r",
//                    "SECc3f3b364885974c38e832e8a7651845a81422f7e79e97e1979fc66916b0eff02",
//                    "3429beb9ba26135ed6193d0db68732c641e16d3edd6bd65dd779b16dc9a8eca9",null,null))
//            ));
//
//            WAREHOUSE_INTERCEPT_CONFIG.put("SYC",//沈阳-天泽（冻品仓）
//            new WarehouseConfigEntity(frozenProductsType,//冻品
//            new WarehouseInterceptionConfig(//沈阳仓（冻品）审单对接群
//            "NZQYprEoWobrZ20qUPKbLAgw81waOeDk",
//                    "SECac80969d041ff8892ac15b70fd20b4491f1756a2c3b8b2f32acff8991a2936b2",
//                    "50d1f1dbd99d18a8a80998bc75ab78cd30aa96a6f9fe5db9ab0716c2f0f9aa02",null,null),
//            Collections.singletonList(new WarehouseExpressDeliveryConfig(//沈阳仓 （冻品）快递售后群
//            UNKNOWN,
//            1,
//            "EpGBa2Lm8ajvKoMmIZoQeErbWgN7R35y",
//                    "SECacba4eed59b688fd3e4f7eff889923b1b4aa639a19d84d5b6f7b351a9a591d34",
//                    "17254730ade1d35fda71e320b77df73d6a082e055251675514395ee16f4de859",null,null))
//            ));
//
//    }
//
////    @Scheduled(cron = "0 0 * * * *", zone = "Asia/Shanghai")
//    public  void storageScheduledTasks() {
//      LocalDateTime endTime=LocalDateTime.now().minusSeconds(2);
//      LocalDateTime startTime=endTime.minusHours(1);
//      List<TradeQueryResponse.OrderItem>orders=findOrders(startTime, endTime, null);
//      updateOrInsertItems(orders);
//    }
//
////    @Scheduled(cron = "0 0 9,12,16 * * ?", zone = "Asia/Shanghai")
//    public  void disposeScheduledTasks() {
//        String sheetId=sdfYYYYMM.format(new Date());
//        int currentHour = LocalDateTime.now().getHour();
//        if(!Arrays.asList(9,12,16).contains(currentHour)){
//            return;
//        }
//        /**
//         * 判断条件 当前时间 和最晚发货时间(－10小时内)已审核分析是否发货 没有做发货提醒
//         * 揽收时间
//         * 同步数据到数据库
//         *
//         * 实际最晚发货时间
//         * 早上9点  查询时间范围 是当天9点到下午16点
//         * 中午 12点   中午12点-下午17点
//         * 下午 16点 去通知 16点-次日早上10点
//         *
//         * 早上 9点 下午 17点
//         * 查询出来已发货的  物流异常提醒
//         */
//        List<SelfOrderDO>timeoutOrders=findTimeoutOrders(currentHour,50);
//        orderHandle(timeoutOrders,sheetId);
//    }
//
//
//    private  void orderHandle(List<SelfOrderDO> timeoutOrders,String sheetId){
//        Map<String,List<SelfOrderDO>>WAREHOUSE_NO_ITEM=timeoutOrders.stream().filter(w->StringUtils.isNotBlank(w.getWarehouseNo())).collect(Collectors.groupingBy(SelfOrderDO::getWarehouseNo));
//        for(String warehouseNo:WAREHOUSE_NO_ITEM.keySet()){
//            List<SelfOrderDO> selfOrderDOS = WAREHOUSE_NO_ITEM.get(warehouseNo);
//            //代发货 审单群
//            List<SelfOrderDO> dropShipData = selfOrderDOS.stream().filter(to->findDropshippingStatus.contains(to.getTradeStatus())).collect(Collectors.toList());
//            //已发货  快递群
//            List<SelfOrderDO> shippedData = selfOrderDOS.stream().filter(to->findShippedStatus.contains(to.getTradeStatus())).collect(Collectors.toList());
//            WarehouseConfigEntity warehouseConfigEntity = WAREHOUSE_INTERCEPT_CONFIG.get(warehouseNo);
//            //审单群
//            WarehouseInterceptionConfig libraryInterceptionConfig = warehouseConfigEntity.getLibraryInterceptionConfig();
//            if (!dropShipData.isEmpty()){
//                List<List<String>> values = dropShipData.stream().filter(o -> ExpressDeliveryUtil.queryLogistics(o.getLogisticsNo()).getTracks().isEmpty()).map(o ->
//                        Arrays.asList(o.getTradeNo(), o.getSrcTids(),dateToStr(o.getEstimateConsignTime()), "未发货")).collect(Collectors.toList());
//                if(!values.isEmpty()){
//                    List<String> headerValues = Arrays.asList("订单编号", "原始单号", "最晚发货时间", "处理类型");
//                    getDocumentReviewUpdates(libraryInterceptionConfig,values,sheetId,rangeDropShipAddressTemplate,headerValues);
//                }
//            }
//
//
//            //快递群
//            List<WarehouseExpressDeliveryConfig> transitInterceptionConfigs = warehouseConfigEntity.getTransitInterceptionConfigs();
//            //根据快递类型分组
//            Map<String,List<SelfOrderDO>>LOGISTICS_TYPE_ITEMS=shippedData.stream().collect(Collectors.groupingBy(e -> judgeExpressDeliveryType(e.getLogisticsNo())));
//            //获取所有的快递群配置
//            Map<String, WarehouseExpressDeliveryConfig>EXPRESS_DELIVERY_TYPE_ITEM= transitInterceptionConfigs.stream().collect(Collectors.toMap(WarehouseExpressDeliveryConfig::getExpressDeliveryType,e->e));
//            if(EXPRESS_DELIVERY_TYPE_ITEM.containsKey(UNKNOWN)){//部分快递仅一个仓库
//                List<SelfOrderDO> allOrders = LOGISTICS_TYPE_ITEMS.values()
//                        .stream()
//                        .flatMap(List::stream)
//                        .collect(Collectors.toList());
//                LOGISTICS_TYPE_ITEMS=new HashMap<String,List<SelfOrderDO>>();
//                LOGISTICS_TYPE_ITEMS.put(UNKNOWN,allOrders);
//            }
//            for(String key:EXPRESS_DELIVERY_TYPE_ITEM.keySet()){//已发货
//                WarehouseExpressDeliveryConfig warehouseExpressDeliveryConfigs=EXPRESS_DELIVERY_TYPE_ITEM.get(key);
//                List<SelfOrderDO>typeOrders=LOGISTICS_TYPE_ITEMS.get(key);
//                if(ObjectUtil.isNotNull(typeOrders)&&!typeOrders.isEmpty()){
//                    //订单编号,原始单号,物流单号,最晚发货时间,发货时间
//                    List<List<String>> values = typeOrders.stream().filter(o -> {
//                        ExpressDeliveryResult result = ExpressDeliveryUtil.queryLogistics(o.getLogisticsNo());
//                        return result.getSucceed() && result.getTracks().isEmpty();
//                    }).map(o ->
//                            Arrays.asList(o.getTradeNo(), o.getSrcTids(), o.getLogisticsNo(), dateToStr(o.getEstimateConsignTime()), dateToStr(o.getConsignTime()), "未揽收")).collect(Collectors.toList());
//                    if(!values.isEmpty()){
//                        List<String> headerValues = Arrays.asList("订单编号", "原始单号", "物流单号", "最晚发货时间", "发货时间", "处理类型");
//                        getSendOrderUpdates(warehouseExpressDeliveryConfigs,values,sheetId,rangeShippedAddressTemplate,headerValues);
//                    }
//                }
//            }
//        }
//    }
//
//
//
//    /**
//     * @param startTime
//     * @param endTime
//     * @param findStatus
//     */
//    public static  List<TradeQueryResponse.OrderItem> findOrders(LocalDateTime startTime, LocalDateTime endTime, String findStatus){
//        List<TradeQueryResponse.OrderItem>orders=new ArrayList<>();
//        String startTimeStr = FORMATTER.format(startTime);
//        String endTimeStr = FORMATTER.format(endTime);
//        TradeQueryResponse tradeQueryResponse = WDTUtil.queryOrderList(startTimeStr, endTimeStr, findStatus, 10, 0);
//        Integer pageSize=200;
//        int totalCount=tradeQueryResponse.getTotalCount()-pageSize;//剩余订单数量
//        if (totalCount>0){
//        orders.addAll(tradeQueryResponse.getOrders());
//            int totalPages=(totalCount+pageSize-1) / pageSize;
//            int currentPageSize=0;
//            for(int pageNo=1;pageNo<=totalPages;pageNo++){
//                currentPageSize=totalCount-pageSize*(pageNo-1);
//                if(currentPageSize>pageSize){
//                    currentPageSize=pageSize;
//                }
//                tradeQueryResponse = WDTUtil.queryOrderList(startTimeStr, endTimeStr,  findStatus, currentPageSize, pageNo);
//                assert tradeQueryResponse != null;
//                orders.addAll(tradeQueryResponse.getOrders());
//            }
//        }
//
//        orders=new ArrayList<>(orders.stream().map(order -> new AbstractMap.SimpleEntry<>(order.getTradeId(), order)) // 创建一个复合键（例如"name:age"）和person的映射项
//        .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (existing, replacement) -> existing)) // 使用Map去重，保留第一个出现的元素（基于复合键）
//        .values());
//        return orders;
//    }
//
//    /**
//     *
//     * @param orders
//     */
//    private void updateOrInsertItems(List<TradeQueryResponse.OrderItem>orders){
//         for(TradeQueryResponse.OrderItem order:orders){
//             updateOrInsertItem(order);
//         }
//    }
//    private void updateOrInsertItem(TradeQueryResponse.OrderItem data){
//
//        String consignTime = data.getConsignTime();
//        String tradeNo = data.getTradeNo();
//        Long tradeId = data.getTradeId();
//        Integer platformId = data.getPlatformId();
//        Integer warehouseType = data.getWarehouseType();
//        Integer tradeStatus = data.getTradeStatus();
//        if(Arrays.asList(4,5).contains(tradeStatus)){//不要的
//          return;
//        }
//        String srcTids = data.getSrcTids();
//        String payAccount = data.getPayAccount();
//        Integer refundStatus = data.getRefundStatus();
//        String payTime = data.getPayTime();
//        String tradeTime = data.getTradeTime();
//        String logisticsNo = data.getLogisticsNo();
//        String logisticsName = data.getLogisticsName();
//        String logisticsCode = data.getLogisticsCode();
//        String logisticsTypeName = data.getLogisticsTypeName();
//        String estimateConsignTime = data.getEstimateConsignTime();
//        String stockoutNo = data.getStockoutNo();
//        Integer logisticsId = data.getLogisticsId();
//        String warehouseNo = data.getWarehouseNo();
//        SelfOrderDO insertItem = new SelfOrderDO();
//        insertItem.setConsignTime(toDate(consignTime));
//        insertItem.setTradeId(tradeId);
//        insertItem.setTradeNo(tradeNo);
//        insertItem.setPlatformId(platformId);
//        insertItem.setWarehouseType(warehouseType);
//        insertItem.setSrcTids(srcTids);
//        insertItem.setPayAccount(payAccount);
//        insertItem.setTradeStatus(tradeStatus);
//        insertItem.setRefundStatus(refundStatus);
//        insertItem.setPayTime(toDate(payTime));
//        insertItem.setTradeTime(toDate(tradeTime));
//        insertItem.setLogisticsNo(logisticsNo);
//        insertItem.setLogisticsName(logisticsName);
//        insertItem.setLogisticsCode(logisticsCode);
//        insertItem.setLogisticsTypeName(logisticsTypeName);
//        insertItem.setEstimateConsignTime(toDate(estimateConsignTime));
//        insertItem.setStockoutNo(stockoutNo);
//        insertItem.setWarehouseNo(warehouseNo);
//        insertItem.setLogisticsId(logisticsId);
//        SelfOrderDO selfOrderDO=selfOrderService.getOne(new QueryWrapper<SelfOrderDO>().eq("src_tids",srcTids));
//        if(ObjectUtil.isNotNull(selfOrderDO)){
//        insertItem.setId(selfOrderDO.getId());
//        selfOrderService.updateById(insertItem);
//        }else {
//        selfOrderService.save(insertItem);
//        }
//    }
//
//    public static Date toDate(String dateStr) {
//        if(StringUtils.isBlank(dateStr)){
//            return null;
//        }
//        sdf.setLenient(false); // 严格模式（禁止自动转换，如 "2023-02-30" 会报错）
//        try {
//            return sdf.parse(dateStr);
//        } catch (ParseException e) {
//           return new Date(Long.parseLong(dateStr));
//        }
//    }
//    public static String dateToStr(Date date) {
//        if(ObjectUtil.isNull(date)){
//            return null;
//        }
//        return sdf.format(date);
//    }
//
//    /**
//     */
//    public  List<SelfOrderDO> findTimeoutOrders(Integer hour,Integer num){
//        List<String>searchTimes=findSearchTime(hour);
//        List<SelfOrderDO>selfOrders=selfOrderService.findSelfOrders(searchTimes,allFindShippedStatus);
//        Map<String,SelfOrderDO>DB_SRCT_IDS_ITEM=selfOrders.stream().collect(Collectors.toMap(SelfOrderDO::getSrcTids,e->e,(existing,replacement)->existing));
//        List<String>allTradeNos=new ArrayList<>(DB_SRCT_IDS_ITEM.keySet());
//        List<List<String>>batchesVals=ListUtils.partition(allTradeNos, num);
//        for(int i=0;i<batchesVals.size();i++){
//        List<TradeQueryResponse.OrderItem>orderItems=WDTUtil.srcTidQueryOrder(String.join(",",batchesVals.get(i)),num,0);
//        assert orderItems!=null;
//        if(!orderItems.isEmpty()){
//        Map<String, TradeQueryResponse.OrderItem>REQ_TRADE_NO_ITEM = orderItems.stream().collect(Collectors.toMap(TradeQueryResponse.OrderItem::getSrcTids,e -> e,(existing,replacement)->existing));
//        for(String key:REQ_TRADE_NO_ITEM.keySet()){
//            SelfOrderDO dbItem=DB_SRCT_IDS_ITEM.get(key);
//            if(ObjectUtil.isNotNull(dbItem)){
//                TradeQueryResponse.OrderItem orderItem = REQ_TRADE_NO_ITEM.get(key);
//                dbItem.setTradeId(orderItem.getTradeId());
//                dbItem.setPlatformId(orderItem.getPlatformId());
//                dbItem.setWarehouseType(orderItem.getWarehouseType());
//                dbItem.setSrcTids(orderItem.getSrcTids());
//                dbItem.setPayAccount(orderItem.getPayAccount());
//                dbItem.setTradeStatus(orderItem.getTradeStatus());
//                dbItem.setRefundStatus(orderItem.getRefundStatus());
//                dbItem.setPayTime(toDate(orderItem.getPayTime()));
//                dbItem.setTradeTime(toDate(orderItem.getTradeTime()));
//                dbItem.setConsignTime(toDate(orderItem.getConsignTime()));
//                dbItem.setLogisticsNo(orderItem.getLogisticsNo());
//                dbItem.setLogisticsName(orderItem.getLogisticsName());
//                dbItem.setLogisticsTypeName(orderItem.getLogisticsTypeName());
//                dbItem.setEstimateConsignTime(toDate(orderItem.getEstimateConsignTime()));
//                dbItem.setStockoutNo(orderItem.getStockoutNo());
//                dbItem.setLogisticsId(orderItem.getLogisticsId());
//                dbItem.setWarehouseNo(orderItem.getWarehouseNo());
//                DB_SRCT_IDS_ITEM.put(key,dbItem);
//            }
//          }
//         }
//
//        }
//
//        List<SelfOrderDO>updateOrders=new ArrayList<>(DB_SRCT_IDS_ITEM.values());
//        updateOrInsertItem(updateOrders);
//
//        return updateOrders;
//    }
//
//    /**
//     * 更新订单数据
//     * @param data
//     */
//    private void updateOrInsertItem(List<SelfOrderDO>data){
//        for(SelfOrderDO selfOrder:data){
//            selfOrderService.updateById(selfOrder);
//        }
//    }
//
//
//    private static List<String> findSearchTime(Integer hour){
//        LocalDateTime localDateTime=LocalDateTime.now();
//        LocalDateTime startDateTime=null;
//        LocalDateTime endDateTime=null;
//        switch (hour){
//            case 9:
//                startDateTime = localDateTime.withHour(9).withSecond(0).withMinute(0);
//                endDateTime = localDateTime.withHour(16).withSecond(0).withMinute(0);
//            break;
//            case 12:
//                startDateTime = localDateTime.withHour(12).withSecond(0).withMinute(0);
//                endDateTime = localDateTime.withHour(17).withSecond(0).withMinute(0);
//            break;
//            case 16:
//                startDateTime = localDateTime.withHour(16).withSecond(0).withMinute(0);
//                endDateTime = localDateTime.plusDays(1).withHour(10).withSecond(0).withMinute(0);
//            break;
//        }
//        List<String> date = new ArrayList<>();
//        assert startDateTime != null;
//        date.add(startDateTime.format(FORMATTER));
//        date.add(endDateTime.format(FORMATTER));
//        return date;
//    }
//    /**
//     * 获取两个LocalDateTime之间的所有整天时间字符串
//     * @param startDateTime 开始时间（可为null）
//     * @param endDateTime 结束时间（可为null）
//     * @return 时间字符串列表，格式为"yyyy-MM-dd HH:mm:ss"
//     */
//    public static List<String> getDailyTimeStrings(LocalDateTime startDateTime, LocalDateTime endDateTime) {
//        List<String> result = new ArrayList<>();
//        // 处理null情况
//        if (startDateTime == null || endDateTime == null) {
//            return result;
//        }
//        // 确保开始时间不晚于结束时间
//        if (startDateTime.isAfter(endDateTime)) {
//            return result;
//        }
//        // 检查是否为整点时间（分钟和秒都为0）
//        boolean isStartWholeHour = isWholeHour(startDateTime);
//        boolean isEndWholeHour = isWholeHour(endDateTime);
//
//        // 处理开始时间（如果不是整点，直接添加）
//        if (!isStartWholeHour) {
//            result.add(startDateTime.format(FORMATTER));
//        }
//
//        // 计算第一个整点时间
//        LocalDateTime current = startDateTime
//                .withMinute(0)
//                .withSecond(0)
//                .withNano(0);
//
//        if (isStartWholeHour) {
//            current = startDateTime;
//        } else {
//            current = current.plusHours(1);
//        }
//        // 添加所有中间的整点时间
//        while (!current.isAfter(endDateTime)) {
//            // 只有当当前时间小于结束时间，或者等于结束时间且结束时间是整点时才添加
//            if (current.isBefore(endDateTime) || (current.equals(endDateTime) && isEndWholeHour)) {
//                result.add(current.format(FORMATTER));
//            }
//            current = current.plusHours(1);
//        }
//        // 处理结束时间（如果不是整点且未被添加过）
//        if (!isEndWholeHour && !endDateTime.equals(startDateTime)) {
//            result.add(endDateTime.format(FORMATTER));
//        }
//        return result;
//    }
//
//    /**
//     * 判断时间是否为整点（分钟和秒都为0）
//     */
//    private static boolean isWholeHour(LocalDateTime dateTime) {
//        return dateTime.getMinute() == 0 && dateTime.getSecond() == 0;
//    }
//
//    /**
//     *     * 获取上次更新的下标
//     *      * String workbookId="Obva6QBXJw6lYwAMFlr3arwxVn4qY5Pr";
//     *      * String sheetId="s1";
//     *      * @param rangeAddressKey
//     * @param rangeAddressKey
//     * @param workbookId
//     * @param sheetId
//     * @return
//     */
//    public Integer ddOptimizeTable(String rangeAddressKey,String workbookId,String sheetId,String rangeAddressTemplate,List<String>headerValues) {
//        String currentSubscriptStr = redisService.getString(rangeAddressKey);
//        Integer currentSubscript=1;
//        if (StringUtils.isBlank(currentSubscriptStr)){
//            List<String>findSheets= DDUtil.getSheets(workbookId).getJSONArray("value").stream().map(val->{
//                JSONObject vm=(JSONObject)val;return vm.getString("name");}).filter(name->name.equals(sheetId)).collect(Collectors.toList());
//            if(!findSheets.isEmpty()){
//                Integer startIndex=currentSubscript;
//                Integer endIndex=startIndex+readBatchSize;
//                currentSubscript=0;
//                for (int i = 0; i <100; i++) {
//                    String rangeAddress=String.format(rangeAddressTemplate,startIndex,endIndex);
//                    JSONObject rsData=JSONObject.parseObject(DDUtil.readSheets(workbookId,sheetId,rangeAddress));
//                    long rssData=rsData.getJSONArray("values").stream().map(v->(List<Object>)v).filter(v->StringUtils.isNotBlank(v.get(0).toString())).count();
//                    currentSubscript= Math.toIntExact(currentSubscript + rssData );
//                    if(rssData==0){break;}
//                    startIndex=endIndex+1;
//                    endIndex=endIndex+readBatchSize;
//                }
//                redisService.setWithExpire(rangeAddressKey,currentSubscript.toString(),dataSaveDays,timeUnit);
//            }else{
//                DDUtil.createSheets(workbookId,sheetId);
//                String rangeAddress=String.format(rangeAddressTemplate,currentSubscript,currentSubscript);
//                DDUtil.updateRange(workbookId,sheetId,rangeAddress, Collections.singletonList(headerValues));
//                redisService.setWithExpire(rangeAddressKey,currentSubscript.toString(),dataSaveDays,timeUnit);
//            }
//        }else {
//            currentSubscript=Integer.parseInt(currentSubscriptStr);
//        }
//        return currentSubscript;
//    }
//
//    /**
//     *     * 获取上次更新的下标
//     *      * String workbookId="Obva6QBXJw6lYwAMFlr3arwxVn4qY5Pr";
//     *      * String sheetId="s1";
//     *      * @param rangeAddressKey
//     * @param workbookId
//     * @param sheetId
//     * @return
//     */
//    public JSONObject qwOptimizeTable(String workbookId,String sheetId,List<String>headerValues) {
//        SpreadSheetGetSheetPropertiesResponse spreadSheetGetSheetProperties = spreadSheetGetSheetProperties(workbookId);
//        String dateStr=sheetId;
//        Integer rowCount=1;
//        List<SpreadSheetGetSheetPropertiesItem>singleton= spreadSheetGetSheetProperties.getProperties().stream().filter(prp -> ObjectUtil.equal(prp.getTitle(), dateStr)).collect(Collectors.toList());
//        if(!singleton.isEmpty()){
//            sheetId=singleton.get(0).getSheetId();
//            rowCount=singleton.get(0).getRowCount();
//        }else{
//            shade.com.alibaba.fastjson2.JSONObject bsResult = batchUpdateSpreadsheet(workbookId, createAddSheetRequest(dateStr,600,10));
//            sheetId = bsResult.getJSONArray("responses").getJSONObject(0).getJSONObject("add_sheet_response").getJSONObject("properties").getString("sheet_id");
//            shade.com.alibaba.fastjson2.JSONObject updateRequest = batchUpdateSpreadsheet(workbookId,createUpdateSheetRequest(sheetId, 0, 0, Collections.singletonList(headerValues)));
//            rowCount=1;
//        }
//        JSONObject param = new JSONObject();
//        param.put("sheetId",sheetId);
//        param.put("rowCount",rowCount);
//        return param;
//    }
//
//    private void getDDSendOrderUpdates(WarehouseExpressDeliveryConfig param,List<List<String>>values,String sheetId,String rangeAddressTemplate,List<String>headerValues){
//        String workbookId = param.getWorkbookId();
//        String secret = param.getSecret();
//        String token = param.getToken();
//        List<String> atMobiles = param.getAtMobiles();
//        List<String> atUserIds = param.getAtUserIds();
//        String rangeAddressKey=String.format(keyTemplate,workbookId,sheetId);
//        Integer currentSubscript=ddOptimizeTable(rangeAddressKey,workbookId,sheetId,rangeAddressTemplate,headerValues);
//        ddImportValuesData(workbookId,sheetId,values,currentSubscript,rangeAddressKey,rangeAddressTemplate);
////        String content="揽收即将超时提醒-测试阶段".concat("\n").concat(values.stream().map(v->"订单编号："+v.get(0)+"\n"+"原始单号："+v.get(1)+"\n"+ "物流单号："+
////                v.get(2)+"\n"+"最晚发货时间："+v.get(3)+"\n"+"发货时间："+v.get(4)+"\n"+"处理类型："+v.get(5)+"\n").collect(Collectors.joining("\n")));
////        String toLinkUrl=String.format(ddLinkUrl,workbookId);
////        content=content.concat("\n").concat(toLinkUrl);
////        DDUtil.sendMessageWebhook(secret,token,content);
//
//        List<List<List<String>>> partitionValues = Lists.partition(values, 9);
//        for(int i=0;i<partitionValues.size();i++){
//            List<List<String>>pv=partitionValues.get(i);
//            String content="揽收即将超时提醒-测试阶段".concat("\n").concat(pv.stream().map(v->"订单编号："+v.get(0)+"\n"+"原始单号："+v.get(1)+"\n"+ "物流单号："+
//                    v.get(2)+"\n"+"最晚发货时间："+v.get(3)+"\n"+"发货时间："+v.get(4)+"\n"+"处理类型："+v.get(5)+"\n").collect(Collectors.joining("\n")));
//            if(i==partitionValues.size()-1){
//                content=content.concat("\n").concat(String.format(ddLinkUrl,workbookId));
//            }
//            DDUtil.sendMessageWebhook(secret,token,content,atUserIds,atMobiles);
//        }
//    }
//
//    private void getQwSendOrderUpdates(WarehouseExpressDeliveryConfig param,List<List<String>>values,String sheetId,List<String>headerValues){
//        String workbookId = param.getWorkbookId();
//        String secret = param.getSecret();
//        String token = param.getToken();
//        JSONObject result = qwOptimizeTable(workbookId, sheetId, headerValues);//企业微信
//        sheetId= result.getString("sheetId");
//        Integer currentSubscript= result.getInteger("rowCount");
//        qwImportValuesData(workbookId,sheetId,values,currentSubscript);
//        List<List<List<String>>> partitionValues = Lists.partition(values, 9);
//        for(int i=0;i<partitionValues.size();i++){
//            List<List<String>>pv=partitionValues.get(i);
//            String content="揽收即将超时提醒-测试阶段".concat("\n").concat(pv.stream().map(v->"订单编号："+v.get(0)+"\n"+"原始单号："+v.get(1)+"\n"+ "物流单号："+
//                    v.get(2)+"\n"+"最晚发货时间："+v.get(3)+"\n"+"发货时间："+v.get(4)+"\n"+"处理类型："+v.get(5)+"\n").collect(Collectors.joining("\n")));
//            if(i==partitionValues.size()-1){
//            content=content.concat("\n").concat(Objects.requireNonNull(getDocumentShareUrl(workbookId)));
//            }
//            WeChatUtil.sendTextMessage(secret,content,false);
//        }
//    }
//    private void getSendOrderUpdates(WarehouseExpressDeliveryConfig param,List<List<String>>values,String sheetId,String rangeAddressTemplate,List<String>headerValues){
//        Integer platform = param.getPlatform();
//        //平台 1钉钉 2企业微信
//        if (ObjectUtil.equal(platform,1)){
//            getDDSendOrderUpdates(param,values,sheetId,rangeAddressTemplate,headerValues);
//        }else {
//            getQwSendOrderUpdates(param,values,sheetId,headerValues);
//        }
//
//    }
//
//
//    /**
//     * 审单群表格更新并通知
//     * @param param
//     * @param values
//     * @param sheetId
//     * @param rangeAddressTemplate
//     * @param headerValues
//     */
//    private void getDocumentReviewUpdates(WarehouseInterceptionConfig param,List<List<String>>values,String sheetId,String rangeAddressTemplate,List<String>headerValues){
//        String workbookId = param.getWorkbookId();
//        String secret = param.getSecret();
//        String token = param.getToken();
//        List<String> atMobiles = param.getAtMobiles();
//        List<String> atUserIds = param.getAtUserIds();
//        String rangeAddressKey=String.format(keyTemplate,workbookId,sheetId);
//        Integer currentSubscript=ddOptimizeTable(rangeAddressKey,workbookId,sheetId,rangeAddressTemplate,headerValues);
//        ddImportValuesData(workbookId,sheetId,values,currentSubscript,rangeAddressKey,rangeAddressTemplate);
//        List<List<List<String>>> partitionValues = Lists.partition(values, 9);
//        for(int i=0;i<partitionValues.size();i++){
//            List<List<String>>pv=partitionValues.get(i);
//            String content="发货超时预警通知-测试阶段".concat("\n").concat(pv.stream().map(v->"订单编号："+v.get(0)+"\n"+"原始单号："+v.get(1)
//                +"\n"+"最晚发货时间："+v.get(2)+"\n"+"处理类型："+v.get(3)).collect(Collectors.joining("\n")));
//            if(i==partitionValues.size()-1){
//                content=content.concat("\n").concat(String.format(ddLinkUrl,workbookId));
//            }
//            DDUtil.sendMessageWebhook(secret,token,content,atUserIds,atMobiles);
//        }
//    }
//
//
//        /**
//         * 出库单列表转参数
//         * @param workbookId
//         * @param sheetId
//         * @param values
//         * @param currentSubscript
//         * @param rangeAddressKey
//         */
//    public void ddImportValuesData(String workbookId,String sheetId,List<List<String>>values,Integer currentSubscript,String rangeAddressKey,String rangeAddressTemplate){
//        int totalSize = values.size();
//        Integer startIndex=currentSubscript;
//        Integer endIndex=startIndex;
//        for (int start = 0; start < totalSize; start += updateBatchSize) {
//            int end = Math.min(start + updateBatchSize, totalSize);
//            List<List<String>>batchValues=values.subList(start, end);
//            startIndex=endIndex+1;
//            endIndex=startIndex+batchValues.size()-1;
//            String rangeAddress=String.format(rangeAddressTemplate,startIndex,endIndex);
//            DDUtil.updateRange(workbookId,sheetId,rangeAddress,batchValues);
//        }
//        redisService.setWithExpire(rangeAddressKey,endIndex.toString(),dataSaveDays,timeUnit);
//    }
//
//    /**
//     * 出库单列表转参数
//     * @param workbookId
//     * @param sheetId
//     * @param values
//     * @param currentSubscript
//     */
//    public void qwImportValuesData(String workbookId,String sheetId,List<List<String>>values,Integer currentSubscript){
//        WeChatUtil.batchUpdateSpreadsheetRecord(workbookId,sheetId,currentSubscript,values);
//    }
//}
